﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WaterRevenueMS.Domain.Common.Models;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace WaterRevenueMS.Domain.ViewModels.BasicSet.MeterType
{
    public class MeterTypeModel : EntityCommon
    {
        public MeterTypeModel()
        {
            Search = new SearchModel();
            Lei_XDM = "10";
            ProtocolItems = new List<SelectListItem>
            {
                new SelectListItem{Text="请选择表型号",Value="0"},
                new SelectListItem{Text="无源16路分线板",Value="1"},
                new SelectListItem{Text="无源总线表(WW协议)",Value="2"},
                new SelectListItem{Text="无源总线表(WH协议)",Value="3"},
                new SelectListItem{Text="脉冲采集器1631",Value="4"},
                new SelectListItem{Text="脉冲采集器3241",Value="5"},
                new SelectListItem{Text="WRSM-5A",Value="6"},
                new SelectListItem{Text="脉冲WG协议-A",Value="7"},
                new SelectListItem{Text="脉冲WG协议",Value="8"},
                new SelectListItem{Text="Modbus-RTU",Value="9"},
                new SelectListItem{Text="天行健CCM04",Value="10"},
                new SelectListItem{Text="西安旌旗电表",Value="11"},
                new SelectListItem{Text="威海天罡热量表",Value="11"}
            };
        }

        public int Id { get; set; }
        [Display(Name = "类型名称")]
        [Required(ErrorMessage="类型名称不能为空")]
        [StringLength(16,ErrorMessage="仪表类型不能大于16个字符")]
        public string Yi_BLX { get; set; }

        [Display(Name = "类型代码")]
        public string Lei_XDM { get; set; }

        [Display(Name="默认值")]
        public byte DefaultValue { get; set; }

        [RegularExpression(@"\d+", ErrorMessage = "必须是数字")]
        [Display(Name="排序序号")]
        public int OrderNo { get; set; }

        [Display(Name="协议类型")]
        [RegularExpression(@"^\+?[1-9][0-9]*$", ErrorMessage = "请选择通讯协议")]
        public byte Tong_XXY { get; set; }
        public List<SelectListItem> ProtocolItems { get; set; }

        public SearchModel Search { get; set; }
    }
    public class SearchModel
    {
        public SearchModel()
        {

        }

        [Display(Name = "类型名称")]
        public string Yi_BLX { get; set; }
    }
}
